package cn.bjxy.javaks.store_ms.service;

import java.util.List;

import cn.bjxy.javaks.store_ms.dao.AdminDaoImpl;
import cn.bjxy.javaks.store_ms.dao.IAdminDao;
import cn.bjxy.javaks.store_ms.entity.AdminEntity;
import cn.bjxy.javaks.store_ms.utils.StoreMSysUtil;

public class AdminServiceImpl implements IAdminService {

	private IAdminDao dao = new AdminDaoImpl();

	AdminServiceImpl() { // 将构造方法设置成了包访问权限
	}

	@Override
	public List<AdminEntity> findAll() {
		return dao.findAll();
	}

	@Override
	public AdminEntity findById(String id) {
		return dao.findById(id);
	}

	@Override
	public List<AdminEntity> findByName(String name) {
		return dao.findByName(name);
	}

	@Override
	public AdminEntity findByNameAndPass(String name, String password) {
		return dao.findByNameAndPass(name, password);
	}

	@Override
	public int delete(String id) {
		return dao.delete(id);
	}

	@Override
	public int add(AdminEntity admin) {
		return dao.add(admin);
	}

	@Override
	public int modify(AdminEntity admin) {
		return dao.modify(admin);
	}

	/**
	 * 获取当前类的代理对象
	 * 
	 * @return
	 */
	public static IAdminService getProxyInstance() {
		return (IAdminService) StoreMSysUtil.getProxyObj(IAdminService.class,
				new LogInvocationHandler(new AdminServiceImpl()));
	}
}
